<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">
        <div class="layui-form-item">
            <label class="layui-form-label">会员</label>
            <div class="layui-input-block">
                <input name="member_key" required placeholder="请输入会员卡号或手机号" value="" class="layui-input">
                <div class="help-block">支持按【卡号】或【手机号】精确匹配</div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">礼品</label>
            <div class="layui-input-block">
                <select name="gift_id" required>
                    <option value="">请选择礼品</option>
                    {foreach $gifts as $g}
                    <option value="{$g.id}">{$g.name}（所需积分：{$g.points_required}{if $g.stock!=-1}，库存：{$g.stock}{else/}，库存：不限{/if}）</option>
                    {/foreach}
                </select>
            </div>
        </div>

        {if $isMaster}
        <div class="layui-form-item">
            <label class="layui-form-label">兑换门店</label>
            <div class="layui-input-block">
                <select name="store_id" required>
                    <option value="">请选择门店</option>
                    {foreach $stores as $s}
                    <option value="{$s.id}">{$s.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        {else/}
        <input type="hidden" name="store_id" value="{$storeId}">
        {/if}

        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="remark" placeholder="可选" class="layui-textarea">{$vo.remark|default=''}</textarea>
            </div>
        </div>
    </div>

    <div class="layui-card-body text-center">
        <button class="layui-btn" type="submit">确认兑换</button>
        <button class="layui-btn layui-btn-danger" type="button" data-close>取消</button>
    </div>
</form>

